package cn.jiyun.service;

import cn.jiyun.mapper.UserMapper;
import cn.jiyun.pojo.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserService {
    @Autowired(required = false)
    private UserMapper userMapper;
    public List<User> findAll() {
        List<User>list=  userMapper.selectAll();
        return list;
    }

    public Integer deleteById(Integer id) {
        int i = userMapper.deleteByPrimaryKey(id);
        System.out.println("id==========="+id);
        return i;
    }

    public Integer updateById(User user) {
        int i = userMapper.updateByPrimaryKey(user);
        return i;
    }

    public void add(User user) {
        userMapper.insertSelective(user);
    }
}
